#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+7;
int n;
vector<int> adj[N];
int vis[N];
int ans = N;
int dfs(int u) {
  vis[u] = true;
  int cnt = 1, res = 0;
  for(auto v:adj[u]) {
    if(vis[v]) continue;
    int s = dfs(v);
    res = max(res, s);
    cnt+=s;
  }
  res = max(n-cnt, res);
  ans = min(ans, res);
  return cnt;
}
int main() {
  cin>>n;
  for(int i=0; i<n; ++i) {
    int u, v; cin>>u>>v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);

  cout<<ans<<'\n';
}